home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / source / copperpalette.s < prev    next >
Text File  |  1993-08-09  |  35KB  |  1,814 lines

  1. rout            ;when this is off, the routine-file will be
  2.             ;assembled, on=testing
  3.             
  4. ;debug            ;when this is on, colors in the background will
  5.             ;show how much time the routine needs.
  6.  
  7.  
  8. routinemode    equ    $0002    ;the routinemode !
  9.  
  10.  
  11. ; the first part of the source handles the things that are necessary to
  12. ; show the picture/copper and playing of the routine.
  13. ; the part between the "******************" lines is the routine-source.
  14. ; at the bottom of the file, there are the necessary incbin-files who
  15. ; are needed to test the routine.
  16. ; these are saved with "save effect" in videotracker. they are raw
  17. ; data files which can be fonts,pictures,landscapes,vectorobjects
  18. ; etcetra.
  19. ; the incbin-files are put in the "variables" table, in the routine-
  20. ; player-handler
  21. ; the place where it's done can be found by searching for "!!!!!!!!"
  22.  
  23.  
  24.     opt    a+    ;devpac 3 optimize
  25.     opt    o+
  26.  
  27.     ifd    rout
  28.     
  29.     ;videotracker routine-test
  30.  
  31.     incdir    "videotracker:include/"
  32.     include    "exec/types.i"
  33.     include    "graphics/gfxbase.i"
  34.     include    "lvo/graphics_lib.i"
  35.     incdir    'videotracker:effect/'
  36.  
  37. vew_wid    equ    44
  38. vew_hgt    equ    290
  39. win_hgt    equ    117
  40. win_str    equ    $1a
  41.  
  42.     SECTION    1,CODE_C
  43. tus
  44.     move.l    ($4).w,a6
  45.     sub.l    a1,a1
  46.     jsr    -$126(a6)        ;findtask
  47.     move.l    d0,curtsk
  48.     move.l    d0,a0
  49.     move.l    $b8(a0),tskpri
  50.  
  51.     lea    dosnam,a1        ;doslib openen
  52.     moveq.l    #0,d0
  53.     move.l    (4).w,a6
  54.     jsr    -408(a6)        ;openlib
  55.     move.l    d0,doslib
  56.  
  57.     bsr.s    label5            ;videotracker opstarten
  58.     
  59.     move.l    curtsk,a0
  60.     move.l    tskpri,$b8(a0)
  61.     move.l    ($4).w,a6
  62.     jsr    -$84(a6)        ;forbid
  63.  
  64.     move.l    doslib,a1
  65.     move.l    (4).w,a6
  66.     jsr    -414(a6)        ;closelib
  67.  
  68.     moveq.l    #0,d0
  69.     rts
  70.     
  71. label5
  72.     move.l    (4).w,a6        ;workbench gedoe
  73.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  74.  
  75.     cmp.b    #50,ntscmode        ;ntsc ?
  76.     beq.s    str.ntsc
  77.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  78. str.ntsc
  79.  
  80.     move.l    (4).w,a6        ;68030 cache off 
  81.     jsr    -120(a6)
  82.  
  83.     btst.b    #1,297(a6)
  84.     beq.s    str.nfc
  85.     lea.l    str.ft,a5
  86.     jsr    -30(a6)
  87. str.nfc
  88.     jsr    -126(a6)
  89.     bra.s    str.fc
  90.     
  91. str.ft
  92.     dc.w    $4e7a,2
  93.     bclr    #0,d0
  94.     bset    #13,d0
  95.     dc.w    $4e7b,2
  96.     rte
  97. str.fc
  98.  
  99.     lea    cprjmp,a2        ;copjmp zetten !
  100.     move.l    #cprbck-8,d0
  101.     move.w    d0,6(a2)
  102.     swap    d0
  103.     move.w    d0,2(a2)
  104.  
  105.     lea    cprbck-8,a2        ;copstr zetten !
  106.     move.l    #cpr,d0
  107.     move.w    d0,6(a2)
  108.     swap    d0
  109.     move.w    d0,2(a2)
  110.  
  111.     bsr    cprsprrem        ;sprites legen
  112.  
  113.     lea    gfxnam,a1        ;graphics lib openen
  114.     move.l    (4).w,a6
  115.     jsr    -408(a6)        ;openlib
  116.     move.l    d0,a6
  117.     move.l    d0,gfxlib
  118.     move.l    38(a6),oldcprlist
  119.  
  120.     bset    #1,$bfe001
  121.     bsr    copbuf            ;copper vullen
  122.  
  123.     bsr    sysoff
  124.  
  125. gadrun
  126.     btst    #6,($bfe001).l
  127.     bne    gadrun
  128.  
  129. scrend
  130. scrend.play
  131.     bsr    syson
  132.  
  133.     move.l    gfxlib,a1
  134.     move.l    (4).w,a6
  135.     jsr    -414(a6)        ;closelib
  136.  
  137. scrend.qb
  138.     moveq.l    #0,d0    
  139.     rts
  140.     
  141.     ;vertical blank interrupt, no blits.
  142.     ;handles counters,interlace,sprite
  143.     ;level 3
  144.  
  145. intvb
  146.     bra.s    intvb.cnt
  147.     dc.l    'VIDU'
  148.     dc.l    'LOOP'
  149. intvb.cnt
  150.     movem.l    d0-d7/a0-a6,-(sp)
  151.     lea    ($dff000).l,a6
  152.  
  153.     move.w    $01e(a6),d0
  154.     btst    #5,d0            ;vblank ?
  155.     bne.s    intvb.vb
  156.  
  157.     bra.s    intcop.end
  158.  
  159. intvb.vb
  160.     bsr    grap
  161.     bsr    palctr            ;palette zetten
  162.     bsr.s    copbuf            ;copper vullen
  163.     
  164. intvb.end
  165.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  166.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  167.     rte
  168.  
  169. intcop.end
  170.     movem.l    (sp)+,d0-d7/a0-a6
  171.     move.l    intvbold,-(sp)
  172.     rts
  173.  
  174.     ;transmission buffer empty routine, BLIT !
  175.     ;handles routines,animations
  176.     
  177. inttbe                    ;tbe interrupt
  178.     movem.l    d0-d7/a0-a6,-(sp)
  179.     lea    ($dff000).l,a6
  180.  
  181.     move.w    $01e(a6),d0
  182.     btst    #0,d0            ;no tbe ?
  183.     beq.s    intdskblk
  184.  
  185.  
  186.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  187.     beq.s    inttbe.cop
  188.     btst    #2,($dff016).l
  189.     beq.s    inttbe.cop
  190.  
  191.     ifd    debug
  192.     move.w    #$700,$dff180
  193.     endc
  194.     
  195.     bsr    rotply            ;routineplayer BLIT !
  196.     bsr.s    copbuf            ;copper vullen
  197.  
  198.     ifd    debug
  199.     move.w    #$070,$dff180
  200.     endc
  201.     
  202. inttbe.cop
  203.  
  204. inttbe.end
  205.     move.w    #$0001,$09c(a6)
  206.     movem.l    (sp)+,d0-d7/a0-a6
  207.     rte
  208.  
  209. intdskblk
  210.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  211.     movem.l    (sp)+,d0-d7/a0-a6
  212.     move.l    inttbeold,-(sp)
  213.     rts
  214.  
  215.  
  216.     ;moves the copperbuffer to the copperlist
  217.     ;sort of double buffering
  218.     
  219. copbuf
  220.     movem.l    d0-d7/a0-a6,-(sp)
  221.  
  222.     lea    ($dff000).l,a6
  223.  
  224. copbuf.novb                ;copperchange overslaan
  225.     moveq.l    #0,d0
  226.     move.b    $005(a6),d0
  227.     lsl.w    #8,d0
  228.     moveq.l    #0,d1
  229.     move.b    $006(a6),d1
  230.     add.w    d1,d0
  231.  
  232.     cmp.w    #$4,d0
  233.     blt    copbuf.novb
  234.  
  235.     cmp.b    #50,ntscmode
  236.     beq.s    copbuf.pal
  237.     cmp.w    #$133-56-8,d0        ;ntsc grens
  238.     bge    copbuf.novb
  239.     bra.s    copbuf.cont
  240. copbuf.pal
  241.     cmp.w    #$133-8,d0        ;pal grens
  242.     bge    copbuf.novb
  243. copbuf.cont
  244.  
  245.     lea    gra.s,a0        ;buffer copieren
  246.     lea    cprbuf,a1
  247.  
  248.     move.w    00*4+2(a0),00*4+2(a1)
  249.     move.w    01*4+2(a0),01*4+2(a1)
  250.     move.w    02*4+2(a0),02*4+2(a1)
  251.     move.w    03*4+2(a0),03*4+2(a1)
  252.     move.w    04*4+2(a0),04*4+2(a1)
  253.     move.w    05*4+2(a0),05*4+2(a1)
  254.     move.w    06*4+2(a0),06*4+2(a1)
  255.     move.w    07*4+2(a0),07*4+2(a1)
  256.     move.w    08*4+2(a0),08*4+2(a1)
  257.     move.w    09*4+2(a0),09*4+2(a1)
  258.  
  259.     move.w    10*4+2(a0),10*4+2(a1)
  260.     move.w    11*4+2(a0),11*4+2(a1)
  261.     move.w    12*4+2(a0),12*4+2(a1)
  262.     move.w    13*4+2(a0),13*4+2(a1)
  263.     move.w    14*4+2(a0),14*4+2(a1)
  264.     move.w    15*4+2(a0),15*4+2(a1)
  265.     move.w    16*4+2(a0),16*4+2(a1)
  266.     move.w    17*4+2(a0),17*4+2(a1)
  267.     move.w    18*4+2(a0),18*4+2(a1)
  268.     move.w    19*4+2(a0),19*4+2(a1)
  269.  
  270.     move.w    20*4+2(a0),20*4+2(a1)
  271.     move.w    21*4+2(a0),21*4+2(a1)
  272.     move.w    22*4+2(a0),22*4+2(a1)
  273.     move.w    23*4+2(a0),23*4+2(a1)
  274.     move.w    24*4+2(a0),24*4+2(a1)
  275.     move.w    25*4+2(a0),25*4+2(a1)
  276.     move.w    26*4+2(a0),26*4+2(a1)
  277.     move.w    27*4+2(a0),27*4+2(a1)
  278.     move.w    28*4+2(a0),28*4+2(a1)
  279.     move.w    29*4+2(a0),29*4+2(a1)
  280.  
  281.     move.w    30*4+2(a0),30*4+2(a1)
  282.     move.w    31*4+2(a0),31*4+2(a1)
  283.     move.w    32*4+2(a0),32*4+2(a1)
  284.     move.w    33*4+2(a0),33*4+2(a1)
  285.     move.w    34*4+2(a0),34*4+2(a1)
  286.     move.w    35*4+2(a0),35*4+2(a1)
  287.     move.w    36*4+2(a0),36*4+2(a1)
  288.     move.w    37*4+2(a0),37*4+2(a1)
  289.     move.w    38*4+2(a0),38*4+2(a1)
  290.     move.w    39*4+2(a0),39*4+2(a1)
  291.  
  292.     move.w    40*4+2(a0),40*4+2(a1)
  293.     move.w    41*4+2(a0),41*4+2(a1)
  294.     move.w    42*4+2(a0),42*4+2(a1)
  295.     move.w    43*4+2(a0),43*4+2(a1)
  296.     move.w    44*4+2(a0),44*4+2(a1)
  297.     move.w    45*4+2(a0),45*4+2(a1)
  298.     move.w    46*4+2(a0),46*4+2(a1)
  299.     move.w    47*4+2(a0),47*4+2(a1)
  300.     move.w    48*4+2(a0),48*4+2(a1)
  301.     move.w    49*4+2(a0),49*4+2(a1)
  302.  
  303.     move.w    50*4+2(a0),50*4+2(a1)
  304.     move.w    51*4+2(a0),51*4+2(a1)
  305.     move.w    52*4+2(a0),52*4+2(a1)
  306.     move.w    53*4+2(a0),53*4+2(a1)
  307.     move.w    54*4+2(a0),54*4+2(a1)
  308.  
  309. copbuf.end
  310.     movem.l    (sp)+,d0-d7/a0-a6
  311.     rts
  312.  
  313.     ;goes back to the workbench
  314.     
  315. syson
  316.     movem.l    d0-d7/a0-a6,-(sp)
  317.  
  318.     move.w    #$0001,$dff09a        ;tbeint uit
  319.     move.l    intvbold,($6c).w
  320.     move.l    inttbeold,($64).w
  321.  
  322.     move.l    4,a6
  323.     jsr    -138(a6)        ;permit
  324.  
  325.     move.l    gfxlib,a6
  326.     jsr    -462(a6)        ;disownblitter
  327.  
  328.     move.l    wbview,a1
  329.     move.l    gfxlib,a6
  330.     jsr    _LVOLoadView(a6)     ; Fix view
  331.     jsr    _LVOWaitTOF(a6)
  332.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  333.  
  334. syson.ras
  335.     cmp.b    #$c0,$dff006        ;prevent copperjump
  336.     bne    syson.ras
  337.  
  338.     move.l    gfxlib,a6
  339.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  340.  
  341.     movem.l    (sp)+,d0-d7/a0-a6
  342.     rts
  343.     
  344.     ;goes back to the gadgetscreen
  345.     
  346. sysoff
  347.     movem.l    d0-d7/a0-a6,-(sp)
  348.      
  349.     move.l    gfxlib,a6
  350.     move.l    gb_ActiView(a6),wbview    ;current view
  351.     sub.l    a1,a1            ; clear a1
  352.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  353.     jsr    _LVOWaitTOF(a6)     ; Wait once
  354.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  355.  
  356.     move.l    gfxlib,a6
  357.     jsr    -456(a6)        ;ownblitter
  358.  
  359.     move.l    4,a6
  360.     jsr    -132(a6)        ;forbid
  361.         
  362.     move.l    ($6c).w,intvbold
  363.     move.l    #intvb,($6c).w
  364.     move.l    ($64).w,inttbeold
  365.     move.l    #inttbe,($64).w
  366.     move.w    #$8001,$dff09a        ;tbeint aan
  367.     bsr    gracpr            ;reset copper
  368.     bsr    copbuf            ;copy copper
  369.     move.l    #cpr,$dff080
  370.  
  371.     movem.l    (sp)+,d0-d7/a0-a6
  372.     rts
  373.     
  374. cprsprrem
  375.     movem.l    d0-d7/a0-a6,-(sp)
  376.     lea    cprspr,a0
  377.     move.l    #sprdat,d0
  378.     move.w    #7,d1
  379. cprsprrem.a
  380.     move.w    d0,3*2(a0)
  381.     swap    d0
  382.     move.w    d0,1*2(a0)
  383.     swap    d0
  384.     add.l    #8,a0
  385.     dbra    d1,cprsprrem.a
  386.     movem.l    (sp)+,d0-d7/a0-a6
  387.     rts
  388.  
  389. varset                    ;variablen neerzetten
  390.     movem.l    d0-d7/a0-a6,-(sp)
  391.     move.l    #var,a0
  392.  
  393.     move.l    #cprbck,var_cprbck(a0)
  394.     move.l    gfxlib,var__GfxBase(a0)
  395.     move.b    ntscmode,var_ntsc(a0)
  396.  
  397.     move.l    curpic1,var_pic1(a0)    ;variabel
  398.     move.l    curpic2,var_pic2(a0)    ;variabel
  399.     move.w    anispd1,var_anispd1(a0)
  400.     move.w    anitel1,var_anitel1(a0)
  401.     movem.l    (sp)+,d0-d7/a0-a6
  402.     rts
  403.     
  404.     ;this routine handles all videotracker-routines
  405.  
  406. rotply    
  407.     movem.l    d0-d7/a0-a6,-(sp)
  408.  
  409.     moveq.l    #0,d0
  410.  
  411.     lea    currot1,a2        ;routine 1
  412.     move.w    rotinf1,d0        ;routine info
  413.     bsr.s    rotplyr
  414.  
  415. rotply.end
  416.     movem.l    (sp)+,d0-d7/a0-a6
  417.     rts
  418.  
  419.     ;this routine handles 1 routine, BLIT !
  420.     
  421. rotplyr
  422.     movem.l    d0-d7/a1-a6,-(sp)
  423.  
  424.     move.l    #rot,(a2)        ;routinestart address
  425.  
  426.     move.b    #50,ntscmode        ;ntsc/pal hz
  427.     clr.l    curpic2            ;background picture
  428.     move.w    #1,anispd1        ;animationspeed
  429.     clr.w    anitel1            ;animat